<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fnx" uri="http://java.sun.com/jsp/jstl/functionsx"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="f" uri="http://www.sctv.com/tags/form"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="/WEB-INF/views/head.jsp"/>
    <style>
        .tabs{}
        .tabs li{float:left;background-color:#f4f4f4;border-left:1px solid #e2e2e2;border-top:1px solid #ddd;border-right:1px solid #ddd;margin-right:0px;}
        .tabs li a{color:#555555;float:left;text-decoration:none;padding:5px 12px;}
        .tabs li a:link,.tabs li a:visited,.tabs li a:hover,.tabs li a:active{text-decoration:none;}
        .tabs li.active{background-color:#FFFFFF;border-left:1px solid #ddd;border-top:1px solid #ddd;border-right:1px solid #ddd;}
        .tabs li.active a{color:#fff;background:#ed5565;border-color:#ed5565;}
        .tabs li.hover{background-color:#e7e7e7;border-left:1px solid #ddd;border-top:1px solid #ddd;border-right:1px solid #ddd;}
        .tabs li.hover a{color:#000;}
    </style>
    <script>
      $(function() {
        $("#radio").buttonset();
        $("#sortHead").headSort();
        $("#tabs li").each(function(){
          $(this).hover(function(){
            if(!$(this).hasClass("active")) {
              $(this).addClass("hover");
            }
          },function(){
            $(this).removeClass("hover");
          });
        });
        if('${init}'=="0"){
          $("#queryBtn").click();
        }
      });
      function confirmDelete() {
        return confirm("<s:message code='confirmDelete'/>");
      }
      function optSingle(opt) {
        if(Cms.checkeds("ids")==0) {
          alert("<s:message code='pleaseSelectRecord'/>");
          return false;
        }
        if(Cms.checkeds("ids")>1) {
          alert("<s:message code='pleaseSelectOne'/>");
          return false;
        }
        var id = $("input[name='ids']:checkbox:checked").val();
        var url = $(opt+id).attr("href");
        if(url) {
          location.href=$(opt+id).attr("href");
        } else {
          alert("<s:message code='noPermission'/>");
        }
      }
      function optMulti(form, action, confirmMsg) {
        if(Cms.checkeds("ids")==0) {
          alert("<s:message code='pleaseSelectRecord'/>");
          return false;
        }
        if(confirmMsg) {
          if($.isFunction(confirmMsg)) {
            if(!confirmMsg()) {
              return false;
            }
          } else {
            if(!confirm(confirmMsg)) {
              return false;
            }
          }
        }
        form.action=action;
        form.submit();
        return true;
      }
      function optDelete(form) {
        if(Cms.checkeds("ids")==0) {
          alert("<s:message code='pleaseSelectRecord'/>");
          return false;
        }
        if(!confirmDelete()) {
          return false;
        }
        form.action='anchordelete.do';
        form.submit();
        return true;
      }
      //刷新
      function optReload() {
        var form=$("#searchForm");
        form.submit();
        return true;
      }
      <c:if test="${!empty refreshLeft}">
      parent.frames["left"].location.href="left.do";
      </c:if>
    </script>
</head>
<body class="skin-blue content-body">
<jsp:include page="/WEB-INF/views/commons/show_message.jsp"/>
<div class="content-header">
    <h1>主播栏目-${node.name}- <s:message code="list"/> <small>(<s:message code="totalElements" arguments="${pagedList.totalElements}"/>)</small></h1>
</div>
<div class="content">
    <div class="box box-primary">
        <div class="box-body table-responsive">
            <form id="searchForm" action="anchor_node_detail_list.do" method="get" class="form-inline ls-search">
                <div class="form-group">
                    <label for="search_CONTAIN_detail.title"><s:message code="info.title"/></label>
                    <input class="form-control input-sm" type="text" id="search_CONTAIN_detail.title" name="search_CONTAIN_detail.title" value="${requestScope['search_CONTAIN_detail.title'][0]}" style="width:150px;"/>
                    <%--<label for="search_CONTAIN_name"><s:message code="node.name"/></label>--%>
                    <%--<input class="form-control input-sm" type="text" id="search_CONTAIN_name" name="search_CONTAIN_name" value="${search_CONTAIN_name[0]}"/></label>--%>
                </div>

                <button class="btn btn-default btn-sm" id="queryBtn" type="submit"><s:message code="search"/></button>
                <f:hidden name="queryNodeId" value="${queryNodeId}"/>
                <f:hidden name="queryNodeType" value="${queryNodeType}"/>
                <f:hidden name="queryParentId" value="${queryParentId}"/>
                <f:hidden id="queryStatus" name="queryStatus" value="${queryStatus}"/>
            </form>
            <form method="post">
                <tags:search_params/>
                <f:hidden name="queryNodeId" value="${queryNodeId}"/>
                <f:hidden name="queryParentId" value="${queryParentId}"/>
                <f:hidden name="queryNodeType" value="${queryNodeType}"/>
                <f:hidden name="queryInfoPermType" value="${queryInfoPermType}"/>
                <f:hidden name="queryStatus" value="${queryStatus}"/>
                <div class="btn-toolbar ls-btn-bar">
                    <div class="btn-group">
                        <shiro:hasPermission name="core:publish_center:create">
                            <%--<button class="btn btn-default" type="button" onclick="location.href='create.do?queryNodeId=${queryNodeId}&queryNodeType=${queryNodeType}&queryInfoPermType=${queryInfoPermType}&queryStatus=${queryStatus}&${searchstring}';"><s:message code="create"/></button>--%>
                            <button class="btn btn-default" type="button" onclick="location.href='anchorcreate.do?parentId=${parent.id}&queryParentId=${queryParentId}&showDescendants=${showDescendants}&${searchstring}';">新建</button>
                        </shiro:hasPermission>
                    </div>
                    <%--<div class="btn-group">--%>
                        <%--<shiro:hasPermission name="core:info:create">--%>
                            <%--<button class="btn btn-default" type="button" onclick="return optDelete(this.form);">添加专题</button>--%>
                        <%--</shiro:hasPermission>--%>
                    <%--</div>--%>
                    <div class="btn-group">
                        <shiro:hasPermission name="core:info:create">
                            <button class="btn btn-default" type="button" onclick="return optDelete(this.form);"><s:message code="delete"/></button>
                        </shiro:hasPermission>
                    </div>
                    <div class="btn-group">
                        <button class="btn btn-default" type="button" onclick="return optReload(this.form);">刷新</button>
                    </div>
                </div>

                <table id="pagedTable" class="table table-condensed table-bordered table-hover ls-tb">
                    <thead id="sortHead" pagesort="<c:out value='${page_sort[0]}' />" pagedir="${page_sort_dir[0]}" pageurl="list.do?page_sort={0}&page_sort_dir={1}&queryNodeId=${queryNodeId}&queryNodeType=${queryNodeType}&queryInfoPermType=${queryInfoPermType}&queryStatus=${queryStatus}&${searchstringnosort}">
                    <tr class="ls_table_th">
                        <th width="25"><input type="checkbox" onclick="Cms.check('ids',this.checked);"/></th>
                        <th width="30" class="ls-th-sort"><span class="ls-sort" pagesort="id">ID</span></th>
                        <th width="60" class="ls-th-sort"><span class="ls-sort" pagesort="id">预览</span></th>
                        <th class="ls-th-sort"><span class="ls-sort" pagesort="detail.title">新闻标题</span></th>
                        <th class="ls-th-sort"><span class="ls-sort" pagesort="publishDate">发布时间</span></th>
                        <th class="ls-th-sort"><span class="ls-sort" pagesort="publishDate">栏目</span></th>
                        <th class="ls-th-sort"><span class="ls-sort" pagesort="publishDate">来源</span></th>
                        <th width="180">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach var="bean" varStatus="status" items="${pagedList.content}">
                        <tr<shiro:hasPermission name="core:info:edit"> ondblclick="location.href=$('#edit_opt_${bean.id}').attr('href');"</shiro:hasPermission>>
                            <td><input type="checkbox" name="ids" value="${bean.id}"/></td>
                            <td align="center"><c:out value="${bean.id}"/></td>
                            <td align="center"><c:out value="预览"/></td>
                            <td align="center">
                                <div><a href="view.do?id=${bean.id}&queryNodeId=${queryNodeId}&queryNodeType=${queryNodeType}&queryInfoPermType=${queryInfoPermType}&queryStatus=${queryStatus}&position=${pagedList.number*pagedList.size+status.index}&${searchstring}" title="<c:out value='${bean.detail.title}'/>"><c:out value="${fnx:substringx_sis(bean.detail.title,30,'...')}"/></a></div>
                            </td>

                            <%--<td align="center">--%>
                                <%--<div>--%>
                                    <%--<span style="color:blue;"><c:out value="${bean.detail.title}"/></span>--%>
                                <%--</div>--%>
                            <%--</td>--%>
                            <td align="center">
                                <div><fmt:formatDate value="${bean.publishDate}" pattern="yyyy-MM-dd HH:mm:ss"/></div>
                            </td>
                            <td align="center">
                                    <c:out value="${bean.node.name}"/>
                            </td>
                            <td align="center"><c:out value="${bean.creator.username}"/></td>
                            <td align="center">
                                <a href="delete.do?ids=${bean.id}&queryParentId=${queryParentId}&showDescendants=${showDescendants}&${searchstring}" onclick="return confirmDelete();" class="ls-opt">引用</a>
                                <a href="delete.do?ids=${bean.id}&queryParentId=${queryParentId}&returnUrl=anchor_node_detail_list&showDescendants=${showDescendants}&${searchstring}" onclick="return confirmDelete();" class="ls-opt">回收</a>
                                <a id="edit_opt_${bean.id}" href="infologic_delete.do?returnUrl=anchor_node_detail_list&id=${bean.id}&position=${pagedList.number*pagedList.size+status.index}&queryParentId=${queryParentId}&returnUrl=anchor_node_detail_list&showDescendants=${showDescendants}&${searchstring}" class="ls-opt">编辑</a>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
                <c:if test="${fn:length(pagedList.content) le 0}">
                    <div class="ls-norecord"><s:message code="recordNotFound"/></div>
                </c:if>
            </form>
            <form action="anchor_node_detail_list.do" method="get" class="ls-page">
                <tags:search_params excludePage="true"/>
                <f:hidden name="queryNodeId" value="${queryNodeId}"/>
                <f:hidden name="queryNodeType" value="${queryNodeType}"/>
                <f:hidden name="queryParentId" value="${queryParentId}"/>
                <f:hidden id="queryStatus" name="queryStatus" value="${queryStatus}"/>
                <tags:pagination pagedList="${pagedList}"/>
            </form>
        </div>
    </div>
</div>
</body>
</html>